package com.repair.order.pojo.convertor;

import com.repair.api.order.response.vo.OrderVO;
import com.repair.order.pojo.dto.OrderCreateParam;
import com.repair.order.pojo.entity.Order;
import org.mapstruct.Mapper;
import org.mapstruct.NullValueCheckStrategy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * @author chunyu
 * @since 2024/10/4,20:07
 */
@Mapper(nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface OrderConvertor {

    OrderConvertor INSTANCE = Mappers.getMapper(OrderConvertor.class);

    /**
     * 订单实体转VO 集合
     * @param order
     * @return
     */
    List<OrderVO> mapToVOList(List<Order> order);

    /**
     * 订单实体转VO
     * @param order
     * @return
     */
    OrderVO mapToVO(Order order);

    /**
     * 订单参数转实体
     * @param param
     * @return
     */
    Order mapToEntity(OrderCreateParam param);
}
